package com.yuexun.dhdoctor.module.meetingNew.model.impl;

import com.yuexun.dhdoctor.base.BaseEntity;
import com.yuexun.dhdoctor.base.bean.model.HelpFileEntity;
import com.yuexun.dhdoctor.module.meetingNew.api.MeetingNewApi;
import com.yuexun.dhdoctor.module.meetingNew.bean.MeetingNewDateBean;
import com.yuexun.dhdoctor.module.meetingNew.bean.MeetingNewQrCodeBean;
import com.yuexun.dhdoctor.module.meetingNew.bean.MeetingNewRoleBean;
import com.yuexun.dhdoctor.module.meetingNew.bean.MeetingNewRoomBean;
import com.yuexun.dhdoctor.module.meetingNew.bean.MeetingNewRoomBeanNew;
import com.yuexun.dhdoctor.module.meetingNew.bean.MeetingNewSignBean;
import com.yuexun.dhdoctor.module.meetingNew.bean.MeetingNewTypeBean;
import com.yuexun.dhdoctor.module.meetingNew.bean.MeetingRoomBean;
import com.yuexun.dhdoctor.module.meetingNew.model.IMeetingNewModel;
import com.yuexun.dhdoctor.util.ApiUtil;

import java.util.Map;

import rx.Observable;

/**
 * Created by work-jx on 2016/11/15.
 */
public class MeetingNewModel implements IMeetingNewModel {
    private MeetingNewApi api;

    public MeetingNewApi ApiInstance() {
        if (api != null) {
            return api;
        } else {
            return ApiUtil.getInstance().createRetrofitApi(MeetingNewApi.class);
        }
    }

    @Override
    public Observable<BaseEntity<MeetingNewDateBean>> getMeetingList(Map<String, String> praise) {
        api = ApiInstance();
        return api.getMeetingList(praise);
    }

    @Override
    public Observable<BaseEntity<MeetingNewSignBean>> getMeetingSign(Map<String, String> praise) {
        api = ApiInstance();
        return api.getMeetingSign(praise);
    }

    @Override
    public Observable<BaseEntity<MeetingNewRoomBean>> getRoomList(Map<String, String> praise) {
        api = ApiInstance();
        return api.getRoomList(praise);
    }

    @Override
    public Observable<BaseEntity<MeetingNewRoomBeanNew>> getRoomList2(Map<String, String> praise) {
        api = ApiInstance();
        return api.getRoomList2(praise);
    }

    @Override
    public Observable<BaseEntity<MeetingNewRoomBean>> getAllRoomList(Map<String, String> praise) {
        api = ApiInstance();
        return api.getAllRoomList(praise);
    }

    @Override
    public Observable<BaseEntity<String>> getJudgeMember(String[] participantIds, Map<String, String> praise) {
        api = ApiInstance();
        return api.getJudgeMember(participantIds, praise);
    }

    @Override
    public Observable<BaseEntity<MeetingNewRoleBean>> getRoleList(Map<String, String> praise) {
        api = ApiInstance();
        return api.getRoleList(praise);
    }

    @Override
    public Observable<BaseEntity<String>> createMeeting(String[] participantIds, String[] readyIds,
                                                        String[] deptIdList,
                                                        String[] deptSignCountList,
                                                        String[] groupIdList,
                                                        String[] groupSignCountList,
                                                        Map<String, String> praise) {
        api = ApiInstance();
        return api.createMeeting(participantIds, readyIds, deptIdList, deptSignCountList, groupIdList, groupSignCountList, praise);
    }

    @Override
    public Observable<BaseEntity<String>> updateMeeting(String[] participantIds, String[] readyIds,
                                                        String[] deptIdList,
                                                        String[] deptSignCountList, Map<String, String> praise) {
        api = ApiInstance();
        return api.updateMeeting(participantIds, readyIds, deptIdList, deptSignCountList, praise);
    }

    @Override
    public Observable<BaseEntity<String>> updateStatus(Map<String, String> praise) {
        api = ApiInstance();
        return api.updateStatus(praise);
    }

    @Override
    public Observable<BaseEntity<String>> getRoomStatusList(Map<String, String> praise) {
        api = ApiInstance();
        return api.getRoomStateList(praise);
    }

    @Override
    public Observable<BaseEntity<MeetingNewQrCodeBean>> getQrCode(Map<String, String> praise) {
        api = ApiInstance();
        return api.getQrCode(praise);
    }

    @Override
    public Observable<BaseEntity<String>> checkMeetingByQrCode(Map<String, String> praise) {
        api = ApiInstance();
        return api.checkMeetingByQrCode(praise);
    }

    @Override
    public Observable<BaseEntity<MeetingNewTypeBean>> getTypeList(Map<String, String> praise) {
        api = ApiInstance();
        return api.getTypeList(praise);
    }

    @Override
    public Observable<BaseEntity<HelpFileEntity>> getTypeDetail(Map<String, String> praise) {
        api = ApiInstance();
        return api.getTypeDetail(praise);
    }

    @Override
    public Observable<BaseEntity<MeetingRoomBean>> getRoomDetail(Map<String, String> praise) {
        api = ApiInstance();
        return api.getMeetRoomDetail(praise);
    }

    @Override
    public Observable<BaseEntity<MeetingNewDateBean>> getMeetingUnReadList(Map<String, String> praise) {
        api = ApiInstance();
        return api.getMeetingUnReadList(praise);
    }

    @Override
    public Observable<BaseEntity<String>> createMeetingAbsence(Map<String, String> praise) {
        api = ApiInstance();
        return api.createMeetingAbsence(praise);
    }

    @Override
    public Observable<BaseEntity<String>> updateMeetingAbsence(Map<String, String> praise) {
        api = ApiInstance();
        return api.updateMeetingAbsence(praise);
    }
}
